<!DOCTYPE HTML>
<html>
<head>
    <title>登陆</title>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="ctx" th:content="${#httpServletRequest.getContextPath()}"/>
    <link href="/css/style.css" rel="stylesheet" type="text/css" media="all"/>


</head>
<body>
<!-- contact-form -->
<div class="message warning">
    <div class="inset">
        <div class="login-head">
            <h1>登陆</h1>
            <!--<div class="alert-close"> </div>-->
        </div>
        <form>
            <li>
                <input type="text" class="text" id="user" placeholder="用户名"><a href="#" class=" icon user"></a>
            </li>
            <div class="clear"></div>
            <li>
                <input type="password" placeholder="密码" id="pwd"> <a href="#" class="icon lock"></a>
            </li>
            <div class="clear"></div>
            <div class="submit">
                <input type="submit" onclick="login()" value="登陆" id="loginBtn">
                <!--<h4><a href="#">Lost your Password ?</a></h4>-->
                <div class="clear"></div>
            </div>

        </form>
    </div>
</div>
</div>
<div class="clear"></div>
<!--- footer --->
<div class="footer">
    <p>Copyright &copy; 2018.</p>
</div>
<script src="/js/jquery.js"></script>
<script>
    function login() {
        $("#loginBtn").attr('disabled', 'disabled')
        var user = $("#user").val()
        var pwd = $("#pwd").val()
        if (!user) {
            alert('请输入账号')
            $("#loginBtn").removeAttr('disabled')
            return false;
        }
        if (!pwd) {
            alert('请输入密码')
            $("#loginBtn").removeAttr('disabled')
            return false;
        }
        var parm = {
            userName: user,
            password: pwd
        }
        $.ajax({
            type: "post",
            url: "/ethLogin/login",
            async: true,
            data: parm,
            success: function (res) {
                if (res.code == 200) {
                    window.location.href = "/uploadExcel";
                } else {
                    alert(res.message);
                    $("#loginBtn").removeAttr('disabled')
                }
            }
        });
    }
</script>
</body>
</html>